package com.example.service.impl;

import com.example.mapper.ProtocolMapper;
import com.example.service.ProtocolService;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

@Service
public class ProtocolServiceImpl implements ProtocolService {
    @Autowired
    private ProtocolMapper protocolMapper;

    @Override
    public Long addPolicy(String comPartyId, String userId, String venderNo,String memo) {
        Map<String, Object> param = new HashMap<>();
        param.put("comPartyId", comPartyId);
        param.put("userId", userId);
        param.put("venderNo", venderNo);
        param.put("memo", memo);

        protocolMapper.addPolicy(param);
        return (Long)param.get("id"); // 返回主键
    }

    @Override
    public int addVenderList(String venderId, String id) {
        return protocolMapper.addVenderList(venderId, id);
    }

    @Override
    public int addVenderFile(String comPartyId, String user, String venderId, String fileName) {
        return protocolMapper.addVenderFile(comPartyId, user, venderId, fileName);
    }

    @Override
    public String getImg(String id) {
        return protocolMapper.getImg(id);
    }

}
